package smarthouse.model;

import java.io.Serializable;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;


/**
 * The persistent class for the house database table.
 * 
 */
@Entity
@NamedQuery(name="House.findAll", query="SELECT h FROM House h")
public class House implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	private int houseId;

	private String address;

	private String adminPassword;

	private String houseName;

	
	private String housePicture;

	private String latitude;

	private String longitude;

	private int postalCode;

	//bi-directional many-to-one association to Room
	@OneToMany(mappedBy="house")
	private List<Room> rooms;

	//bi-directional many-to-one association to User
	@OneToMany(mappedBy="house")
	private List<User> users;
/**
 * Default constructor
 */
	public House() {
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public int getHouseId() {
		return this.houseId;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setHouseId(int houseId) {
		this.houseId = houseId;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public String getAddress() {
		return this.address;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setAddress(String address) {
		this.address = address;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public String getAdminPassword() {
		return this.adminPassword;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setAdminPassword(String adminPassword) {
		this.adminPassword = adminPassword;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public String getHouseName() {
		return this.houseName;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setHouseName(String houseName) {
		this.houseName = houseName;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public String getHousePicture() {
		return this.housePicture;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setHousePicture(String housePicture) {
		this.housePicture = housePicture;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public String getLatitude() {
		return this.latitude;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setLatitude(String latitude) {
		this.latitude = latitude;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public String getLongitude() {
		return this.longitude;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public int getPostalCode() {
		return this.postalCode;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setPostalCode(int postalCode) {
		this.postalCode = postalCode;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public List<Room> getRooms() {
		return this.rooms;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setRooms(List<Room> rooms) {
		this.rooms = rooms;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public Room addRoom(Room room) {
		getRooms().add(room);
		room.setHouse(this);

		return room;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public Room removeRoom(Room room) {
		getRooms().remove(room);
		room.setHouse(null);

		return room;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public List<User> getUsers() {
		return this.users;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public void setUsers(List<User> users) {
		this.users = users;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public User addUser(User user) {
		getUsers().add(user);
		user.setHouse(this);

		return user;
	}
	/**
	 * Getter/Setter
	 * @return
	 */
	public User removeUser(User user) {
		getUsers().remove(user);
		user.setHouse(null);

		return user;
	}

}